package cn.butcher21;

import cn.butcher21.dao.DBDao;
import cn.butcher21.utils.BuildScene;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;

import java.io.File;
import java.util.Map;

public class Main extends Application {
    public static Stage stage;

    @Override
    public void start(Stage primaryStage) throws Exception {
        stage = primaryStage;
        Parent root = FXMLLoader.load(getClass().getResource("view/login.fxml"));
        primaryStage.setTitle("欢迎登录-海澜之家");
        primaryStage.setScene(new Scene(root, 700, 400));
        primaryStage.getIcons().add(new Image(new File("src/main/resources/login.png").toURI().toString()));
        primaryStage.show();
        BuildScene.stages.put("loginStage", stage);
        new BuildScene();
    }

    public static void main(String[] args) {
        // 启动前检查表
        DBDao.checkTableExist();
        // 正式运行
        launch(args);
    }
}
